import Vue from 'vue'
import Vuex from 'vuex'
import Per from "vuex-persistedstate";
import user from './modules/user'
import author from './modules/author'
import goods from './modules/goods'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    tabs: {
      diaogan: "钓竿",
      xian: "线组",
      fu: "浮漂",
      er: "饵料药",
      deng: "钓鱼灯",
      chao: "抄网",
      yi: "钓箱椅",
      fang: "防护",
      wai: "户外",
      all: "所有分类",
    }
  },
  getters: {
  },
  mutations: {
  },
  actions: {
  },
  modules: {
    user,
    author,
    goods,
  },
  //持久化插件-----存数据
  plugins:[  new Per({
    // 设置存储方法
    storage: window.sessionStorage,
    reducer(state) {
      return {
        // 只储存state中的assessmentData
        user: state.user,
      };
    },
  }),]
})
